<template>
    <div class="bord">
        <slot name="canClick"></slot>
        <slot id="bordSort" name="cantClick" @click="$emit('clickFn')"></slot>
    </div>
</template>
<!--使用方法<div slot="cantClick" @click="sureGetLocationFn" class="com_black"></div>-->
<script>
    export default {
        name: "bord",
        props:{notAddClass:Boolean},
        data(){
            return{
                scrollTop:0
            }
        },
        mounted(){
            if( !this.notAddClass ){
                let that = this;
                that.scrollTop = $(window).scrollTop();
                document.body.className = 'ovfHiden';
                document.documentElement.className = 'ovfHiden';
                $('#app').css({"position":"relative","top":-that.scrollTop,"height":"100%"})
            }
        },
        beforeDestroy(){
            if( !this.notAddClass ){
                let that = this;
                document.body.className = '';
                document.documentElement.className = '';
                $('#app').css({"position":"static","top":0,"height":"auto"});
                $(window).scrollTop(that.scrollTop);
            }
        },
    }
</script>

<style scoped>
    .com_black {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1040;
        background-color: rgba(0, 0, 0, 0.5); }
</style>